<?php

/**
 * Lord_Form_Decorator_Description
 * 
 * Декораторы для Errors
 * 
 * @author Игорь Будасов aka Lord <igor.budasov@gmail.com>
 */
 
class Lord_Form_Decorator_Description extends Zend_Form_Decorator_Abstract
{
	protected $_placement = 'APPEND';
	
	public function render($content)
	{     
        $element  = $this->getElement();
        $description = $element->getDescription();
        
        /**
        * формируем сообщение подсказки
        */
        if(!empty($description))
        {
            $output = "<span id='tooltiper'><a title='".str_replace('"', '″', $description)."'><img src='/design/images/icons/information.png'></a></span>";
        }
        // Получаем объект  Zend_Layout
        $layout = Zend_Layout::getMvcInstance();
        // Получаем объект  вида
        $view = $layout->getView();
        
        $placement = $this->_placement;
        $separator = $this->getSeparator();

        switch ($placement) {
            case 'PREPEND':
                return $output . $separator . $content;
            case 'APPEND':
            default:
                return $content . $separator . $output;
        }
	}

}
?>
